package com.yanqu.road.server.logic.recharge.limit.activity;

import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.config.goods.MallInfo;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.entity.mall.LimitBuyResult;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.server.manger.activity.rankunionwar.RankUnionWarMgr;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;

public class RankUnionWarActivityMallLimit extends BaseActivityMallLimit{

    public RankUnionWarActivityMallLimit(long userId, MallInfo mallInfo, ActivityInfo activityInfo) {
        super(userId, mallInfo, activityInfo);
    }

    @Override
    protected int activityCheck() {
        //要 充值的限购？？？
        if(!ActivityMgr.activityInShowTime(activityInfo)){
            return GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
        }
        if(activityInfo.getType() != eActivityType.RankUnionWar.getValue()){
            return GameErrorCode.E_ACTIVITY_NO_IN_TIME_CANNOT_BUY;
        }
        return 0;
    }

    @Override
    protected boolean isSystemUnLock() {
        return SystemOpenMgr.systemOpen(player, eSystemId.RankUnionWar.getValue());
    }

    @Override
    protected LimitBuyResult buyCountLimit() {
        return activityMallCountLimit(player);
    }
    @Override
    protected int logicCheck() {
        if(!RankUnionWarMgr.isUserCanBuyRmb(activityInfo.getActivityId(), player.getUserId())){
            return GameErrorCode.E_RANKUNIONWAR_USER_CANNOT_PLAY;
        }
        return 0;
    }
}
